package com.njtoyo.taxi.admin.rest.wrapper.business.operation_rule.online_valuation;

import com.njtoyo.taxi.admin.rest.pojo.dto.rule.online_price_rule.OnlinePriceOptionDto;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@Data
public class OnlineValuationAddUpdateWrapper {

    private Long id;

    private Long driverRegionId;
    private Boolean isActive;
    private Boolean canEditPrice;
    private String startPriceKM;
    private String startPriceMinute;
    private String refreshKM;
    private String refreshTime;

    private RuleDetail[] workRuleDetails;

    private RuleDetail[] weekendRuleDetails;


    @Data
    @Accessors(chain = true)
    public static class RuleDetail {
        private String title;
        private Long detailId;
        private TimeRange[] timeRanges;
        /**
         * 起步价
         */
        private String startPrice;

        /**
         * 超出里程费
         */
        private String mileageUnitPrice;
        private String timeUnitPrice;
        //等待费
        private Waiting waiting;
        //乘客加价
        private PriceMarkUp priceMarkup;
        //空驶费
        private EmptyBackFee emptyBackFee;
        private Refresh refresh;
        private BadWeather badWeather;
        private Holiday holiday;
        private OnlinePriceOptionDto driverCommission;
        private OnlinePriceOptionDto infoFee;
        private Flag flag;

        @Data
        @Accessors(chain = true)
        public static class Holiday {
            private String price;
            private Days[] days;
        }

        @Data
        @Accessors(chain = true)
        public static class Flag {
            private Boolean startingFee = true;
            private Boolean exceedStarting;
            private Boolean waiting;
            private Boolean priceMarkup;
            private Boolean emptyBackFee;
            private Boolean refresh;
            private Boolean badWeather;
            private Boolean holiday;
            private Boolean driverCommission;
            private Boolean infoFee;
        }

        @Data
        @Accessors(chain = true)
        public static class Days {
            private String startTime;
            private String endTime;
            private Integer index;
        }

        @Data
        @Accessors(chain = true)
        public static class BadWeather {
            private String price;
            private String startTime;
            private String endTime;
        }

        @Data
        @Accessors(chain = true)
        public static class Refresh {
            private String mileage;
            private String time;
        }


        @Data
        @Accessors(chain = true)
        public static class TimeRange {
            private Integer index;
            private String startTime;
            private String endTime;
        }

        @Data
        @Accessors(chain = true)
        public static class EmptyBackFee {
            private String baseMileage;
            private String ratio;
        }

        @Data
        @Accessors(chain = true)
        public static class Waiting {
            /**
             * 免费等待时长,单位:分钟
             */
            private String freeTime;
            /**
             * 超时等待费,单位:元/分钟
             */
            private String timeCost;
            /**
             * 封顶金额,单位:元
             */
            private String limit;
        }

        @Data
        @Accessors(chain = true)
        public static class PriceMarkUp {
            private String rangeStart;
            private String rangeEnd;
            private String step;
        }
    }

}
